﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class czfy : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
            return;
        }
        loadData();
    }


    private void loadData()
    {
        string strsql = string.Format("SELECT * FROM [xiaoqu] ");
        string strtext = "";
        ManageData md = new ManageData(util.DATACONNECTION);
        if (md != null)
        {
            DataSet ds = md.ExecDS(strsql);
            if (ds != null && ds.Tables.Count > 0)
            {
                foreach (DataRow dr  in ds.Tables[0].Rows)
                {
                    string strsql1 = string.Format("SELECT * FROM [louhao] where [p_id] = '{0}'",dr["id"]);
                    DataSet ds1 = md.ExecDS(strsql1);
                    if (ds1 != null && ds1.Tables.Count> 0)
                    {
                        foreach (DataRow dr1 in ds1.Tables[0].Rows)
                        {
                            string strname = string.Format("{0}-{1}", dr["show_name"], dr1["showname"]);
                            strtext += getStr(strname, dr1["id"].ToString());
                            

                        }
                    }
                }
            }
        }
        this.Literal1.Text = strtext;  
    }

    /// <summary>
    /// 
    /// </summary>
    /// <param name="name">楼体名称</param>
    /// <param name="size">层数</param>
    /// <param name="sizeOf">每层户数</param>
    /// <returns></returns>
    private string getStr(string name,string id)
    {
        return "<tr style=\"\" onmouseout=\"this.style.backgroundColor='';\" onmouseover=\"this.style.backgroundColor='#EBEBEB';\"" +
                        "align=\"center\">" +
                        "<td width=\"186\">" +
                            name +
                        "</td>" +                                             
                        "<td>" +
                            "<a href=\"fyshow.aspx?name=" + name +
                            "&id=" + id +                           
                            " \">查找本楼房源</a>" +
                        "</td>" +
                    "</tr>";
    }
}
